#ifndef UART_CONFIG_H
#define UART_CONFIG_H

#define bit0 1
#define bit1 1<<1
#define bit2 1<<2
#define bit3 1<<3
#define bit4 1<<4
#define bit5 1<<5
#define bit6 1<<6
#define bit7 1<<7
#define bit8 1<<8
#define bit9 1<<9
#define bit10 1<<10
#define bit11 1<<11
#define bit12 1<<12
#define bit13 1<<13
#define bit14 1<<14
#define bit15 1<<15
#define bit16 1<<16
#define bit17 1<<17
#define bit18 1<<18
#define bit19 1<<19
#define bit20 1<<20
#define bit21 1<<21
#define bit22 1<<22
#define bit23 1<<23
#define bit24 1<<24
#define bit25 1<<25
#define bit26 1<<26
#define bit27 1<<27
#define bit28 1<<28
#define bit29 1<<29
#define bit30 1<<30
#define bit31 1<<31

#define bit0_14 (bit0|bit1|bit2|bit3|bit4|bit5|bit6|bit7|bit8|bit9|bit10|bit11|bit12|bit13|bit14)
#define bit16_23 (bit16|bit17|bit18|bit19|bit20|bit21|bit22|bit23)
#define bit0_7 (bit0|bit1|bit2|bit3|bit4|bit5|bit6|bit7)

//Serial pc(USBTX, USBRX); // ! MBED Utilise UART0

extern int DIVADDVAL, MULVAL, DLL, DLM, PCLK;
float lookuptable(float FRest_calcule, int pclk, int dlm, int dll);
int find_optimal_uart_config(int BR);  // BR = Baud Rate
int find_optimal_uart_config_for_cclk(int sysclock, int BR);
int set_optimal_uart_config(int BR);  // BR = Baud Rate
int set_optimal_uart_config_for_cclk(int sysclock, int BR);

#endif
